package top.huntwolf.admin.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import top.huntwolf.admin.component.URLMessageCenter;
import top.huntwolf.admin.interceptor.LoginInterceptor;
import top.huntwolf.admin.interceptor.StoreInterceptor;

import java.util.List;
import java.util.Map;

@Configuration
public class ShopConfig implements WebMvcConfigurer {

    //不配置这个不能在拦截器注入bean
    @Bean
    public StoreInterceptor storeInterceptor(){
        return new StoreInterceptor();
    }

    @Autowired
    URLMessageCenter urlMessageCenter;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(storeInterceptor())
                .addPathPatterns("/banner/**")
                .addPathPatterns("/address/**")
                .addPathPatterns("/book/**")
                .addPathPatterns("/condition/**")
                .addPathPatterns("/cart/**")
                .addPathPatterns("/exhibition/**")
                .addPathPatterns("/order/**")
                .addPathPatterns("/subject/**")
                .addPathPatterns("/topical/**")
                .addPathPatterns("/user/**")
                .addPathPatterns("/wxPay/**")
                .excludePathPatterns("/wxPay/callback")
                .excludePathPatterns("/wxPay/refund/callback");
    }
}
